#include<iostream>
#include"DevelopmentTray.h"
using namespace std;


// 0=SOLDIER, 1=MONOPOLY, 2=ROADBUILDING, 3=YEAROFPLENTY, 4=MARKET, 5=LIBRARY, 6=UNIVERSITY, 7=GOVERNORSHOUSE, 8=CHAPEL
DevelopmentTray::DevelopmentTray(){
	for(int i=0;i<9;i++)
		dArray[i] = 0;
}

DevelopmentTray::DevelopmentTray(int nS, int nMo, int nR, int nY, int nMa, int nL, int nU, int nG, int nC){
	dArray[0] = nS;
	dArray[1] = nMo;
	dArray[2] = nR;
	dArray[3] = nY;
	dArray[4] = nMa;
	dArray[5] = nL;
	dArray[6] = nU;
	dArray[7] = nG;
	dArray[8] = nC;
}

int DevelopmentTray::getNmbOfDev(int arrayIndex){
	return dArray[arrayIndex];
}

string DevelopmentTray::getDevName(int arrayIndex){
	switch(arrayIndex){
	case 0:
		return "soldier";
		break;
	case 1:
		return "monopoly";
		break;
	case 2:
		return "road building";
		break;
	case 3:
		return "years of plenty";
		break;
	case 4:
		return "market";
		break;
	case 5:
		return "library";
		break;
	case 6:
		return "university";
		break;
	case 7:
		return "governor's house";
		break;
	case 8:
		return "chapel";
		break;
	default:
		return "bad return from DevelopmentTray::getDevName";
	}
}

bool DevelopmentTray::hasAnyDev(){
	int counter = 0;
	for(int i=0;i<9;i++)
		if(dArray[i]!=0)
			counter++;
	return(counter!=0);
}

void DevelopmentTray::setNmbOfDev(int arrayIndex, int nmb){
	dArray[arrayIndex] = nmb;
}

void DevelopmentTray::printDevelopmentTray(){
	cout<<"development cards"<<endl;
	// Soldier card
	cout<<"soldiers:"<<dArray[0]<<", ";
	// Progress cards
	cout<<"monopoly:"<<dArray[1]<<", ";
	cout<<"road building:"<<dArray[2]<<", ";
	cout<<"years of plenty:"<<dArray[3]<<endl;
	// Victory point cards
	cout<<"market:"<<dArray[4]<<", ";
	cout<<"library:"<<dArray[5]<<", ";
	cout<<"university:"<<dArray[6]<<", ";
	cout<<"governor\'s house:"<<dArray[7]<<", ";
	cout<<"chapel:"<<dArray[8]<<endl;
}